package pl.perseus.dao;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import pl.perseus.model.Classes;
import pl.perseus.model.User;

@Repository
public class ClassesDao extends BaseDao<Classes> implements IClassesDao{
 
	
	public ClassesDao() {
		super("Classes");
	}

	@Override
    public Classes selectByIdClasses(Long id) {
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("id", id);
        return queryForObject("getByIdClasses", map);
    }
	
	@Override
	public Classes insertClasses(Classes classes){
		return insertBean("insertClasses", classes);
	}
 
	@Override
	public List<Classes> getAllClasses(){
		Map<String, Object> map = new HashMap<String, Object>();
    	map.put("active", true);
		return queryForList("getByActiveClasses", map);
	}
	
	@Override
	public List<Classes> getClassesForTeacher(User user){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userId", user.getId());
		return queryForList("getByClassesUser", map);
	}
	
}
